<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								电梯名称：<input type="text" name="elevatorName"/>
							</li>
							<li>
								电梯类型：
								<select  name="elevatorType">
									<option value="">所有</option>
									<option value="0">直梯</option>
									<option value="1">扶梯</option>
								</select>
							</li>
							<li class="select-time">
								<span>申请日期：</span>
								<input type="text" style="width: 280px" class="time-input" id="startTime" name="applicationDate"/>
							</li>

							<li>
								审核状态：
								<select  name="auditStatus">
									<option value="">所有</option>
									<option value="0">待审核</option>
									<option value="1">通过</option>
									<option value="2">不通过</option>
								</select>
							</li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<a class="btn btn-default btn-outline" title="添加直梯" onclick="addStraightLadder()" shiro:hasPermission="business:elevatorInfo:add">
					<img src="../../img/ele_01.png">
				</a>
				<a class="btn btn-default btn-outline" title="添加扶梯" onclick="addEscalator()" shiro:hasPermission="business:elevatorInfo:add">
					<img src="../../img/ele_02.png">
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('business:elevatorInfo:edit')}]];
        var removeFlag = [[${@permission.hasPermi('business:elevatorInfo:remove')}]];
        var prefix = ctx + "business/elevatorInfo";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "电梯",
				search: false,
		        showExport: true,
                columns: [{
		            radio: true
		        },
				{
					field : 'elevatorId', 
					title : '电梯',
					visible: false
				},
				{
					title: "序号",
					formatter: function (value, row, index) {
						return $.table.serialNumber(index);
					}
				},
				{
					field : 'elevatorName', 
					title : '电梯名称',
					sortable: true
				},
				{
					field : 'registeredCode', 
					title : '注册码',
					sortable: true
				},
				{
					field : 'elevatorType', 
					title : '电梯类别',
					formatter: function (value, row, index) {
						if (value == 0){
							return "直梯"
						}else if (value == 1){
							return "扶梯"
						}
					}
				},
				{
					field : 'applicationDate', 
					title : '申请日期',
					sortable: true
				},
				{
					field : 'auditStatus', 
					title : '审核状态',
					formatter: function (value, row, index) {
						if (value == 0){
							return "待审核"
						}else if (value == 1){
							return "通过"
						}else if (value == 2){
							return "不通过"
						}
					}
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	if (row.elevatorType == 0){//直梯
							actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="editStraightLadder(\'' + row.elevatorId + '\')"><i class="fa fa-edit"></i> 编辑</a> ');
						} else if (row.elevatorType == 1) {//扶梯
							actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="editEscalator(\'' + row.elevatorId + '\')"><i class="fa fa-edit"></i> 编辑</a> ');
						}
						actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="installInfo(\'' + row.elevatorId + '\')"><i class="fa fa-cog"></i> 安装</a> ');
						actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="#" onclick="exFactoryInfo(\'' + row.elevatorId + '\')"><i class="fa fa-indent"></i> 出厂</a> ');
						actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.elevatorId + '\')"><i class="fa fa-remove"></i> 删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });

		/* 新增直梯 */
		function addStraightLadder() {
			var url = prefix + "/addStraightLadder";
			$.modal.openFull("新增直梯", url);
		}

		/* 新增扶梯 */
		function addEscalator() {
			var url = prefix + "/addEscalator";
			$.modal.openFull("新增扶梯", url);
		}

		/* 修改直梯 */
		function editStraightLadder(elevatorId) {
			var url = prefix + "/editStraightLadder/"+elevatorId;
			$.modal.openFull("修改直梯", url);
		}

		/* 修改扶梯 */
		function editEscalator(elevatorId) {
			var url = prefix + "/editEscalator/"+elevatorId;
			$.modal.openFull("修改扶梯", url);
		}

		/* 安装信息 */
		function installInfo(elevatorId) {
			var url = prefix + "/installInfo/"+elevatorId;
			$.modal.openFull("安装信息", url);
		}

		/* 出厂信息 */
		function exFactoryInfo(elevatorId) {
			var url = prefix + "/exFactoryInfo/"+elevatorId;
			$.modal.openFull("出厂信息", url);
		}
    </script>
</body>
</html>